<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <title>DASHGUM - Bootstrap Admin Template</title>


    {% load static %}
    <link rel="stylesheet" href="{% static 'assets/css/style-qr.css' %}">
    <link rel="stylesheet" href="{% static 'assets/css/notice.min.css' %}">
    <link rel="stylesheet"
          href="{% static 'assets/css/default.min.css' %}">

    <!-- Bootstrap core CSS -->
    <link href="{% static 'assets/css/bootstrap.css' %}" rel="stylesheet">
    <!--external css-->
    <link href="{% static 'assets/font-awesome/css/font-awesome.css' %}" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="{% static 'assets/js/bootstrap-datepicker/css/datepicker.css' %}" />
    <link rel="stylesheet" type="text/css" href="{% static 'assets/js/bootstrap-daterangepicker/daterangepicker.css' %}" />

    <!-- Custom styles for this template -->
    <link href="{% static 'assets/css/style.css' %}" rel="stylesheet">
    <link href="{% static 'assets/css/style-responsive.css' %}" rel="stylesheet">

    <link href="{% static 'assets/css/purchase.css' %}" rel="stylesheet">
    <link href="{% static 'assets/css/the-datepicker.css' %}" rel="stylesheet">



  </head>

  <body>

  <section id="container" >
      <!-- **********************************************************************************************************************************************************
      TOP BAR CONTENT & NOTIFICATIONS
      *********************************************************************************************************************************************************** -->
      <!--header start-->
      <header class="header black-bg">
        <div class="sidebar-toggle-box">
            <div class="fa fa-bars tooltips" data-placement="right" data-original-title="Toggle Navigation"></div>
        </div>
      <!--logo start-->
      <a href="index.html" class="logo"><b>MD集团物料管理系统</b></a>
      <!--logo end-->
      <div class="nav notify-row" id="top_menu">
          <!--  notification start -->
      
  </header>
<!--header end-->

<!-- **********************************************************************************************************************************************************
MAIN SIDEBAR MENU
*********************************************************************************************************************************************************** -->
<!--sidebar start-->
<aside>
    <div id="sidebar"  class="nav-collapse ">
        <!-- sidebar menu start-->
        <ul class="sidebar-menu" id="nav-accordion">
        
              <p class="centered"><img src="{% static 'assets/img/ui-sam.jpg' %}" class="img-circle" width="60"></a></p>
              <h5 class="centered">物料管理</h5>
                  
            <li class="mt">
                <a href="{% url 'MM:login' %}">
                    <i class="fa fa-dashboard"></i>
                    <span>主页</span>
                </a>
            </li>

            <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-desktop"></i>
                    <span>供应商管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="general.html">创建新供应商</a></li>
                    <li><a  href="buttons.html">查看或修改供应商信息</a></li>
                    {% comment %} <li><a  href="panels.html">Panels</a></li> {% endcomment %}
                </ul>
            </li>

            <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-cogs"></i>
                    <span>商品管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="calendar.html">创建新商品</a></li>
                    <li><a  href="gallery.html">查看或修改商品信息</a></li>
                    <li><a  href="todo_list.html">查看商品库存</a></li>
                </ul>
            </li>
            {% comment %} <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-book"></i>
                    <span>采购订单管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="blank.html">Blank Page</a></li>
                    <li><a  href="login.html">Login</a></li>
                    <li><a  href="lock_screen.html">Lock Screen</a></li>
                </ul>
            </li> {% endcomment %}
            <li class="sub-menu">
                <a class="active" href="javascript:;" >
                    <i class="fa fa-tasks"></i>
                    <span>收货管理</span>
                </a>
                <ul class="sub">
                    <li class="active"><a  href="form_component.html">创建商品收据</a></li>
                    <li class="active"><a  href="form_component.html">查看商品收据</a></li>
                    <li class="active"><a  href="form_component.html">创建发票收据</a></li>
                    <li class="active"><a  href="form_component.html">查看发票收据</a></li>
                    <li class="active"><a  href="form_component.html">付款</a></li>
                </ul>
            </li>
            <li class="sub-menu">
                <a href="javascript:;" >
                    <i class="fa fa-th"></i>
                    <span>采购订单管理</span>
                </a>
                <ul class="sub">
                    <li><a  href="/mm/purchaserequisition/getpq/">采购申请</a></li>
                    <li><a  href="/mm/quotation/vreview/">供应商评估管理</a></li>
                    <li><a  href="/mm/purchaseorder/searchpo/">采购订单</a></li>
                </ul>
            </li>
            

        </ul>
        <!-- sidebar menu end-->
    </div>
</aside>
      <!--sidebar end-->
      
      <!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
          	<h3><i class="fa fa-angle-right"></i> 创建采购订单</h3>
              <div class="row mt">
                <div class="col-lg-12">
                    
                <div class="form-panel3">
                    <form class="form-horizontal style-form" method="post">
             
                            <div class="col-sm-9" id="rfq-search">
                    
                                    <div class="col-sm-1 col-sm-1 control-label" id="rfq-tag1">
                                        采购申请编码
                                    </div>
                                    <div class="col-sm-2" id="rfq-search1">
                                        <input type="text" class="form-control" name = "id" placeholder="请输入" id="prcode">
                                        <button type="button" class="btn btn-link " data-toggle="modal" data-target="#myModalpr">忘记编码？</button>

                                    </div>
                                    <div class="col-sm-1 col-sm-1 control-label" >
                                        商品编码
                                    </div>
                                    <div class="col-sm-2" id="rfq-search1">
                                        <input type="text" class="form-control" placeholder="请输入"   name="mete"  id="spcode">
                                        <button type="button" class="btn btn-link " data-toggle="modal" data-target="#myModalgood">忘记编码？</button>
                                    </div>
                                    <div class="col-sm-1 col-sm-1 control-label" >
                                        集合码
                                    </div>
                                    <div class="col-sm-2" id="rfq-search1">
                                        <input type="text" class="form-control"  name="collNo" placeholder="请输入">
                                    </div>
                                  
                                  
                                <!-- </div> -->
                                <button type="submit" class="btn btn-success" id="btn-rfq-search">搜索</button>

                              
                            <!-- <div class="col-lg-3">

                            </div> -->
                            </div>
                    </form>
                    
                </div>
            </div>
            </div>
       
               <!--搜索采购申请编码modal-->
      <div class="col-sm-12">
        <div class="modal fade" id="myModalpr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                  <h4 class="modal-title" id="myModalLabel">搜索采购申请编码</h4>
                </div>
                <div class="modal-body">
                  <!-- Hi there, I am a Modal Example for Dashgum Admin Panel. -->
                  <!-- 搜索条件 -->
                  <form class="form-horizontal style-form" id="pr" method="post">
                    <fieldset>
                        <div class="form-group">
                            <label class="col-sm-4 col-sm-4 control-label">
                                <div class="pull-right">创建者编码:</div>
                                </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="cname" id="cname">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-4 col-sm-4 control-label">
                                <div class="pull-right">创建时间:</div>
                                </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="ctime" id="ctime" onclick="date(this)">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-4 col-sm-4 control-label">
                                <div class="pull-right">商品编码:</div>
                                </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="gcode" id="gcode">
                            </div>
                            <div class="col-sm-2">
                                <input class="btn btn-theme02" type="submit" name="submit" value="submit">
                            </div>
                        </div>
                      </fieldset>
                </form>
                

                <table  class="table table-bordered table-striped table-condensed">
                    <thead>
                        <!-- tr 指定表行标签-->
                        <tr>
                            <!-- th 设置表头内容，默认加粗-->
                            <th>采购申请编码</th>
                            <th>创建者编码</th>
                            <th>创建时间</th>
                            <th>商品编码</th>
                            <th>条目编码</th>
                        </tr>
                    </thead>
                    <tbody id="prDiv">


                    </tbody>
                </table>
                <script>
                    $('#pr').on('submit', function(e) {
                        e.preventDefault();
                        $.ajax(
                        {
                            type: "POST",
                            url: ,
                            data:{
                                $("#cname").val(),
                                $("#ctime").val(),
                                $("#gcode").val(),
                                csrfmiddlewaretoken: '{{ csrf_token }}',
                                dataType: "json"
                            },
                            success: function(data) {
                              //  $('#material_result').text(data);
                                var dataObj=eval("("+data+")");
                                var out = "";
                                var i;
                                //"pk": 1, "fields": {"mname": "CHLK", "mType": "HALB", "mGroup": "AS", "meaunit": "ABC", "netWeight": 1, "weightUnit": "ABC", "transGrp": "T", "loadingGrp": "L", "industrySector": "I"}
                                for(i = 0; i < dataObj.length; i++) {
                                    //out += '<p '+ dataObj[i].fields.mname + '>' + '</p><br>';<a href="basic_table.html#">Company Ltd</a>
                                    out += '<tr><td>'+ /*采购申请编码*/+ '</td><td>' + /*创建者编码*/ + '</td><td>' + /*创建时间*/+ '</td><td>' + /*物料编码*/+ '</td><td>' + /*条目编码*/+'</td><tr>';
                                }
                                document.getElementById("prDiv").innerHTML=out;
                            },
                            failure: function() {
        
                            }
                        })
                    });
                    $("table").on("dblclick","tr",function(e){
                        
                        document.getElementById("prcode").value=$(this).find('td').eq(0).text();
                        $('#myModalpr').modal('hide')
                        
                    })
                    
                </script>
                </div>
                <div class="modal-footer">
                </div>
              </div>
            </div>
          </div>
        </div>
<!--搜索采购申请编码modal-->

      <!--搜索商品编码modal-->
      <div class="col-sm-12">
        <div class="modal fade" id="myModalgood" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                  <h4 class="modal-title" id="myModalLabel">搜索商品编码</h4>
                </div>
                <div class="modal-body">
                  <!-- Hi there, I am a Modal Example for Dashgum Admin Panel. -->
                  <!-- 搜索条件 -->
                  <form class="form-horizontal style-form" id="material" method="post">
                    <fieldset>
                        <div class="form-group">
                            <label class="col-sm-4 col-sm-4 control-label">
                                <div class="pull-right">商品名称:</div>
                                </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="mname" id="mname">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-4 col-sm-4 control-label">
                                <div class="pull-right">商品类型:</div>
                                </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="industrySector" id="industrySector">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-4 col-sm-4 control-label">
                                <div class="pull-right">储存位置:</div>
                                </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="mType" id="mType">
                            </div>
                            <div class="col-sm-2">
                                <input class="btn btn-theme02" type="submit" name="submit" value="submit">
                            </div>
                        </div>
                      </fieldset>
                </form>
                

                <table  class="table table-bordered table-striped table-condensed">
                    <thead>
                        <!-- tr 指定表行标签-->
                        <tr>
                            <!-- th 设置表头内容，默认加粗-->
                            <th>表头1</th>
                            <th>表头2</th>
                        </tr>
                    </thead>
                    <tbody id="searchDiv">


                    </tbody>
                </table>
                <script>
                    $('#material').on('submit', function(e) {
                        e.preventDefault();
                        $.ajax(
                        {
                            type: "POST",
                            data:{
                                mname: $("#mname").val(),
                                mType: $("#mType").val(),
                                industrySector: $("#industrySector").val(),
                                csrfmiddlewaretoken: '{{ csrf_token }}',
                                dataType: "json"
                            },
                            success: function(data) {
                              //  $('#material_result').text(data);
                                var dataObj=eval("("+data+")");
                                var out = "";
                                var i;
                                //"pk": 1, "fields": {"mname": "CHLK", "mType": "HALB", "mGroup": "AS", "meaunit": "ABC", "netWeight": 1, "weightUnit": "ABC", "transGrp": "T", "loadingGrp": "L", "industrySector": "I"}
                                for(i = 0; i < dataObj.length; i++) {
                                    //out += '<p '+ dataObj[i].fields.mname + '>' + '</p><br>';<a href="basic_table.html#">Company Ltd</a>
                                    out += '<tr><td>'+ dataObj[i].pk+ '</td><td>' + dataObj[i].fields.mname +'</td><tr>';
                                }
                                document.getElementById("searchDiv").innerHTML=out;
                            },
                            failure: function() {
        
                            }
                        })
                    });
                    $("table").on("dblclick","tr",function(e){
                        
                        document.getElementById("materialInput").value=$(this).find('td').eq(0).text();
                        $('#myModalgood').modal('hide')
                        
                    })
                    
                </script>
                </div>
                <div class="modal-footer">
                </div>
              </div>
            </div>
          </div>
        </div>
<!--搜索商品编码modal-->

            <div class="col-md-12 mt">
                <div class="content-panel">
                    <table class="table table-hover">
                     <div id="table-pr-head"> <h4><i class="fa fa-angle-right"></i> 报价申请列表</h4>
                    
                    </div>  
                        <hr>
                        <thead>
                        <tr>
                            <th>报价申请单编码</th>
                            <th>参考请购单编码</th>
                            <th>商品编码</th>
                            <th>集合码</th>
                            <th>数量</th>
                            <th>报价</th>
                            <th>货币</th>
                            <th>拒绝情况</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
         {%  for c in quoatations  %}
                        <tr>
                            <td>{{ c.id }}</td>
                            <td>{{ c.ri_id }}</td>
                            <td>{{ c.ri__meterial__material_id }}</td>
                            <td>{{c.collNo}}</td>
                            <td>{{ c.quantity }}</td>
                            <td>{{c.price}}</td>
                            <td>{{c.currency}}</td>
                            <td>{{c.rej}}</td>
                            <td>
                     <a href="/mm/purchaseorder/cresys/{{ c.id }}/"> <button class="btn btn-primary btn-xs">转化</button></a>    
                    </td> 
                        </tr>
                        {% endfor %}
                    </tbody>
                    </table>
                  </div><! --/content-panel -->
            </div><!-- /col-md-12 -->



		</section><! --/wrapper -->
      </section><!-- /MAIN CONTENT -->

      <!--main content end-->
      <!--footer start-->
      <footer class="site-footer">
          <div class="text-center">
              2014 - Alvarez.is
              <a href="purchase_request.html" class="go-top">
                  <i class="fa fa-angle-up"></i>
              </a>
          </div>
      </footer>
      <!--footer end-->
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="assets/js/jquery.scrollTo.min.js"></script>
    <script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>


    <!--common script for all pages-->
    <script src="assets/js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="assets/js/the-datepicker.js"></script>

    <script>
            function date(time){
            var datepicker = new TheDatepicker.Datepicker(time);
            datepicker.render();
            }
    </script>
  <script>
      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });

  </script>

  </body>
</html>
